pdf.text "Resumen del Viaje", :size => 30, :style => :bold

pdf.text "Destino: #{@trip.tri_country} - #{@trip.tri_city}"
pdf.text "Fecha de Salida: #{@trip.tri_start_date.strftime("%d-%m-%Y")}"
pdf.text "Fecha de Regreso: #{@trip.tri_end_date.strftime("%d-%m-%Y")}"
pdf.text "Lugar de Hospedaje: #{@trip.tri_lodging}"

pdf.move_down(30)
pdf.text "Quienes van al viaje?", :size=> 20, :style => :bold
people_going = ''
@user_invited.each do |user_trip|
	if current_user.id == user_trip.id
		people_going = "Tu"
	else
		people_going = "#{people_going}, #{user_trip.name} #{user_trip.lastname}"
	end
end

pdf.text people_going

pdf.move_down(30)
pdf.text "Cual es el itinerario?", :size=> 20, :style => :bold
y =490
current_page = 1
itineraries_per_page = 0
@itineraries.each do |itinerary|
	pdf.image open(itinerary.iti_image_url), :fit => [150,150], :position => :left
	pdf.text_box "#{itinerary.iti_location} 
				  Fecha de Salida: #{itinerary.iti_start_date.strftime("%d-%m-%Y")} 
				  Fecha de Regreso: #{itinerary.iti_end_date.strftime("%d-%m-%Y")}", 
		:width    => 300, 
		:height => pdf.font.height * 5,
		:overflow => :ellipses, 
		:at       => [160,y]
	pdf.move_down(15)
	pdf.stroke_horizontal_rule
	pdf.move_down(15)
	y = y-130
	itineraries_per_page = itineraries_per_page + 1
	if (itineraries_per_page == 3 and current_page == 1) or (itineraries_per_page == 5 and current_page != 1)
		pdf.start_new_page
		current_page = current_page + 1
		itineraries_per_page = 0
		y= 710
	end
end



